import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:get/get.dart';
import 'package:getwidget/getwidget.dart';
import 'package:meal/constant/sizes.dart';
import 'package:meal/route/route.dart';
import 'package:meal/ui/draw_under_line.dart';
import 'package:meal/utils/colors.dart';
import 'package:meal/utils/styles.dart';
import 'package:meal/utils/tools.dart';
import 'package:pasteboard/pasteboard.dart';
import 'package:url_launcher/url_launcher.dart';

///
/// 团购订单详情
///
class GroupOrderInfo extends StatefulWidget {
  const GroupOrderInfo({Key? key}) : super(key: key);

  @override
  State<GroupOrderInfo> createState() => _GroupOrderInfoState();
}

class _GroupOrderInfoState extends State<GroupOrderInfo> {
  String hintText = "";
  int selectedIndex = -1;

  var conditions = [
    "未及时付款",
    "买家不想要了",
    "恶意买家/同行捣乱",
    "缺货",
    "买家点错菜、点多了",
    "其他",
  ];

  TextStyle get defaultStyle {
    return StylesUtils.customTextStyle(color: ColorsUtils.color797, fontSize: Sizes.default15);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: ToolsUtils.getDefaultBackgroundColor(),
      appBar: AppBar(
        backgroundColor: ToolsUtils.getDefaultBackgroundColor(),
        leading: Container(
            width: Sizes.default80,
            alignment: Alignment.center,
            child: InkWell(
              onTap: () {
                Get.back();
              },
              child: GFAvatar(
                size: Sizes.default30,
                backgroundColor: Colors.black.withOpacity(0.5),
                child: ToolsUtils.getUrlSvg(
                    'https://cdn7.axureshop.com/demo/1525603/images/团购订单详情_未付款/u3522.svg',
                    width: Sizes.default10,
                    height: Sizes.default16),
              ),
            )),
        leadingWidth: Sizes.default80,
        automaticallyImplyLeading: false,
        elevation: 0,
        actions: [
          Container(
            width: Sizes.default80,
            alignment: Alignment.center,
            child: GFAvatar(
              size: Sizes.default30,
              backgroundColor: Colors.black.withOpacity(0.5),
              child: ToolsUtils.getUrlSvg(
                  'https://cdn7.axureshop.com/demo/1525603/images/团购订单详情_未付款/u3525.svg',
                  width: Sizes.default10,
                  height: Sizes.default16),
            ),
          )
        ],
      ),
      body: SingleChildScrollView(
        padding: const EdgeInsets.symmetric(horizontal: Sizes.default20),
        child: Column(
          children: [
            Container(
              height: Sizes.default80,
              alignment: Alignment.centerLeft,
              child: Text(
                '未使用/已使用/交易关闭',
                style: StylesUtils.customTextStyle(
                    color: ColorsUtils.color363, fontSize: Sizes.default25),
              ),
            ),
            Container(
              decoration: BoxDecoration(
                  color: Colors.white, borderRadius: BorderRadius.circular(Sizes.default10)),
              padding: const EdgeInsets.symmetric(
                  horizontal: Sizes.default15, vertical: Sizes.default15),
              child: ListBody(
                children: [
                  Container(
                    alignment: Alignment.centerLeft,
                    child: Row(
                      children: [
                        Text.rich(TextSpan(children: [
                          WidgetSpan(
                              child: ToolsUtils.getUrlSvg(
                                  'https://cdn7.axureshop.com/demo/1525603/images/团购订单详情_未付款/u3549.svg',
                                  width: Sizes.default15,
                                  height: Sizes.default15),
                              alignment: PlaceholderAlignment.middle),
                          TextSpan(
                              text: ' 随时退',
                              style: StylesUtils.customTextStyle(
                                  fontSize: Sizes.default15, color: ColorsUtils.color333))
                        ])),
                        const SizedBox(
                          width: Sizes.default20,
                        ),
                        Text.rich(TextSpan(children: [
                          WidgetSpan(
                              child: ToolsUtils.getUrlSvg(
                                  'https://cdn7.axureshop.com/demo/1525603/images/团购订单详情_未付款/u3549.svg',
                                  width: Sizes.default15,
                                  height: Sizes.default15),
                              alignment: PlaceholderAlignment.middle),
                          TextSpan(
                              text: ' 过期退',
                              style: StylesUtils.customTextStyle(
                                  fontSize: Sizes.default15, color: ColorsUtils.color333))
                        ])),
                        const SizedBox(
                          width: Sizes.default20,
                        ),
                        Text.rich(TextSpan(children: [
                          WidgetSpan(
                              child: ToolsUtils.getUrlSvg(
                                  'https://cdn7.axureshop.com/demo/1525603/images/团购订单详情_未付款/u3549.svg',
                                  width: Sizes.default15,
                                  height: Sizes.default15),
                              alignment: PlaceholderAlignment.middle),
                          TextSpan(
                              text: ' 推荐自提',
                              style: StylesUtils.customTextStyle(
                                  fontSize: Sizes.default15, color: ColorsUtils.color333))
                        ]))
                      ],
                    ),
                  ),
                  Container(
                    alignment: Alignment.centerLeft,
                    margin: const EdgeInsets.symmetric(vertical: Sizes.default15),
                    child: Text(
                      '感谢您使用小默外卖的团购优惠功能~',
                      style: StylesUtils.customTextStyle(color: ColorsUtils.color797),
                    ),
                  ),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: [
                      Container(
                          constraints: const BoxConstraints.expand(
                              width: Sizes.default100, height: Sizes.default30),
                          alignment: Alignment.center,
                          decoration: BoxDecoration(
                              border: Border.all(color: ColorsUtils.rgba(204, 204, 204, 1)),
                              borderRadius: BorderRadius.circular(Sizes.default5)),
                          child: InkWell(
                            onTap: () {
                              Get.toNamed(RouteGet.groupAdd);
                            },
                            child: Text(
                              '克隆团购',
                              style: StylesUtils.customTextStyle(
                                  fontSize: Sizes.default15, color: ColorsUtils.color797),
                            ),
                          )),
                      const SizedBox(
                        width: Sizes.default20,
                      ),
                      Container(
                          constraints: const BoxConstraints.expand(
                              width: Sizes.default100, height: Sizes.default30),
                          alignment: Alignment.center,
                          decoration: BoxDecoration(
                              border: Border.all(color: ColorsUtils.rgba(255, 110, 83, 1)),
                              borderRadius: BorderRadius.circular(Sizes.default5)),
                          child: InkWell(
                            onTap: closedTrade,
                            child: Text(
                              '关闭交易',
                              style: StylesUtils.customTextStyle(
                                  fontSize: Sizes.default15, color: ColorsUtils.colorFf6),
                            ),
                          )),
                    ],
                  )
                ],
              ),
            ),
            Container(
              decoration: BoxDecoration(
                  color: Colors.white, borderRadius: BorderRadius.circular(Sizes.default10)),
              padding: const EdgeInsets.symmetric(
                  horizontal: Sizes.default10, vertical: Sizes.default10),
              margin: const EdgeInsets.only(top: Sizes.default20),
              child: ListBody(
                children: [
                  Column(
                    children: [
                      SizedBox(
                        height: Sizes.default70,
                        child: Row(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            GFImageOverlay(
                              width: Sizes.default70,
                              height: Sizes.default70,
                              image: const NetworkImage(
                                  'https://img1.baidu.com/it/u=3033226715,2238019049&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500'),
                              borderRadius: BorderRadius.circular(Sizes.default5),
                            ),
                            Expanded(
                                child: Container(
                              padding: const EdgeInsets.only(left: Sizes.default15),
                              child: Column(
                                children: [
                                  Row(
                                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                    children: [
                                      Text(
                                        '烤肉两人套餐',
                                        style: StylesUtils.customTextStyle(
                                            color: ColorsUtils.color333, fontSize: Sizes.default16),
                                        overflow: TextOverflow.ellipsis,
                                      ),
                                      Text(
                                        '￥163.25',
                                        style: StylesUtils.customTextStyle(
                                            color: ColorsUtils.color333, fontSize: Sizes.default16),
                                      )
                                    ],
                                  ),
                                  Expanded(child: Container()),
                                  Container(
                                    alignment: Alignment.centerLeft,
                                    child: Text(
                                      'x2',
                                      style: StylesUtils.customTextStyle(
                                          fontSize: Sizes.default16, color: ColorsUtils.color333),
                                    ),
                                  )
                                ],
                              ),
                            ))
                          ],
                        ),
                      ),
                      Container(
                        margin: const EdgeInsets.symmetric(vertical: Sizes.default15),
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Text(
                              '未使用1份',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.colorFf6, fontSize: Sizes.default12),
                            ),
                            Text(
                              '2022-12-22 23:59 前有效',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color999, fontSize: Sizes.default12),
                            )
                          ],
                        ),
                      ),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.end,
                        children: [
                          InkWell(
                            onTap: () {
                              Get.toNamed(RouteGet.groupAdd);
                            },
                            child: Container(
                              alignment: Alignment.center,
                              constraints: const BoxConstraints.expand(
                                  width: Sizes.default80, height: Sizes.default30),
                              decoration: BoxDecoration(
                                borderRadius: BorderRadius.circular(Sizes.default15),
                                border: Border.all(color: ColorsUtils.rgba(228, 228, 228, 1)),
                              ),
                              child: Text(
                                '克隆团购',
                                style: StylesUtils.customTextStyle(
                                    color: ColorsUtils.color797, fontSize: Sizes.default13),
                              ),
                            ),
                          ),
                          const SizedBox(
                            width: Sizes.default20,
                          ),
                          InkWell(
                            onTap: () {
                              Get.toNamed(RouteGet.groupOrderDetail);
                            },
                            child: Container(
                              alignment: Alignment.center,
                              constraints: const BoxConstraints.expand(
                                  width: Sizes.default80, height: Sizes.default30),
                              decoration: BoxDecoration(
                                borderRadius: BorderRadius.circular(Sizes.default15),
                                border: Border.all(color: ColorsUtils.rgba(255, 110, 83, 1)),
                              ),
                              child: Text(
                                '查看详情',
                                style: StylesUtils.customTextStyle(
                                    color: ColorsUtils.colorFf6, fontSize: Sizes.default13),
                              ),
                            ),
                          )
                        ],
                      )
                    ],
                  ),
                  Container(
                    margin: const EdgeInsets.only(top: Sizes.default20),
                    child: Column(
                      children: [
                        SizedBox(
                          height: Sizes.default70,
                          child: Row(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              GFImageOverlay(
                                width: Sizes.default70,
                                height: Sizes.default70,
                                image: const NetworkImage(
                                    'https://img1.baidu.com/it/u=3033226715,2238019049&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500'),
                                borderRadius: BorderRadius.circular(Sizes.default5),
                              ),
                              Expanded(
                                  child: Container(
                                padding: const EdgeInsets.only(left: Sizes.default15),
                                child: Column(
                                  children: [
                                    Row(
                                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                      children: [
                                        Text(
                                          '烤肉两人套餐',
                                          style: StylesUtils.customTextStyle(
                                              color: ColorsUtils.color333,
                                              fontSize: Sizes.default16),
                                          overflow: TextOverflow.ellipsis,
                                        ),
                                        Text(
                                          '￥163.25',
                                          style: StylesUtils.customTextStyle(
                                              color: ColorsUtils.color333,
                                              fontSize: Sizes.default16),
                                        )
                                      ],
                                    ),
                                    Expanded(child: Container()),
                                    Container(
                                      alignment: Alignment.centerLeft,
                                      child: Text(
                                        'x2',
                                        style: StylesUtils.customTextStyle(
                                            fontSize: Sizes.default16, color: ColorsUtils.color333),
                                      ),
                                    )
                                  ],
                                ),
                              ))
                            ],
                          ),
                        ),
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Container(
                              alignment: Alignment.centerLeft,
                              child: Text(
                                '已退款',
                                style: StylesUtils.customTextStyle(
                                    color: '#FF9900', fontSize: Sizes.default12),
                              ),
                            ),
                            Expanded(
                                child: Container(
                                    alignment: Alignment.centerRight,
                                    child: Row(
                                      mainAxisAlignment: MainAxisAlignment.end,
                                      children: [
                                        InkWell(
                                          onTap: () {
                                            Get.toNamed(RouteGet.groupAdd);
                                          },
                                          child: Container(
                                            alignment: Alignment.center,
                                            constraints: const BoxConstraints.expand(
                                                width: Sizes.default80, height: Sizes.default30),
                                            decoration: BoxDecoration(
                                              borderRadius: BorderRadius.circular(Sizes.default15),
                                              border: Border.all(
                                                  color: ColorsUtils.rgba(228, 228, 228, 1)),
                                            ),
                                            child: Text(
                                              '克隆团购',
                                              style: StylesUtils.customTextStyle(
                                                  color: ColorsUtils.color797,
                                                  fontSize: Sizes.default13),
                                            ),
                                          ),
                                        ),
                                        const SizedBox(
                                          width: Sizes.default20,
                                        ),
                                        InkWell(
                                          onTap: () {
                                            Get.toNamed(RouteGet.groupOrderDetail);
                                          },
                                          child: Container(
                                            alignment: Alignment.center,
                                            constraints: const BoxConstraints.expand(
                                                width: Sizes.default80, height: Sizes.default30),
                                            decoration: BoxDecoration(
                                              borderRadius: BorderRadius.circular(Sizes.default15),
                                              border: Border.all(
                                                  color: ColorsUtils.rgba(255, 110, 83, 1)),
                                            ),
                                            child: Text(
                                              '查看详情',
                                              style: StylesUtils.customTextStyle(
                                                  color: ColorsUtils.colorFf6,
                                                  fontSize: Sizes.default13),
                                            ),
                                          ),
                                        )
                                      ],
                                    )))
                          ],
                        )
                      ],
                    ),
                  )
                ],
              ),
            ),
            Container(
              decoration: BoxDecoration(
                  color: Colors.white, borderRadius: BorderRadius.circular(Sizes.default10)),
              padding: const EdgeInsets.symmetric(
                  horizontal: Sizes.default10, vertical: Sizes.default10),
              margin: const EdgeInsets.only(top: Sizes.default20),
              child: ListBody(
                children: [
                  Container(
                      alignment: Alignment.centerLeft,
                      height: Sizes.default50,
                      child: DrawUnderLine(
                        dx: Sizes.default5,
                        dy: Sizes.default10,
                        child: Text(
                          '商品信息',
                          style: StylesUtils.customTextStyle(color: ColorsUtils.color797),
                        ),
                      )),
                  SizedBox(
                    height: Sizes.default40,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text('商品数量', style: defaultStyle),
                        Text('共3件', style: defaultStyle),
                      ],
                    ),
                  ),
                  SizedBox(
                    height: Sizes.default40,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text('商品总价', style: defaultStyle),
                        Text('￥167.45', style: defaultStyle),
                      ],
                    ),
                  ),
                  SizedBox(
                    height: Sizes.default40,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text('订单总价', style: defaultStyle),
                        Text('￥167.45', style: defaultStyle),
                      ],
                    ),
                  ),
                  SizedBox(
                    height: Sizes.default40,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text('应付款', style: defaultStyle),
                        Text('￥167.45', style: defaultStyle),
                      ],
                    ),
                  ),
                  SizedBox(
                    height: Sizes.default40,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text('本单预计收入', style: defaultStyle),
                        Text('￥167.45',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.colorFf0, fontSize: Sizes.default15)),
                      ],
                    ),
                  ),
                ],
              ),
            ),
            Container(
              decoration: BoxDecoration(
                  color: Colors.white, borderRadius: BorderRadius.circular(Sizes.default10)),
              padding: const EdgeInsets.symmetric(
                  horizontal: Sizes.default10, vertical: Sizes.default10),
              margin: const EdgeInsets.only(top: Sizes.default20),
              child: ListBody(
                children: [
                  DrawUnderLine(
                      dy: Sizes.default10,
                      child: Container(
                          alignment: Alignment.topLeft,
                          height: Sizes.default50,
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Text(
                                '顾客信息',
                                style: StylesUtils.customTextStyle(color: ColorsUtils.color797),
                              ),
                              InkWell(
                                onTap: callMobile,
                                child:  Container(
                                  constraints: BoxConstraints.tight(const Size(26, 26)),
                                  decoration: BoxDecoration(
                                      borderRadius: BorderRadius.circular(Sizes.default13),
                                      border: Border.all(
                                          color: ColorsUtils.parseColorFromHexString(
                                              ColorsUtils.colorCcc))),
                                  alignment: Alignment.center,
                                  child: ToolsUtils.getUrlSvg(
                                      'https://cdn7.axureshop.com/demo/1525603/images/团购订单详情_未付款/u3537.svg',
                                      width: Sizes.default13,
                                      height: Sizes.default13),
                                )
                              ),
                            ],
                          ))),
                  SizedBox(
                    height: Sizes.default40,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text('预留手机号', style: defaultStyle),
                        Text('+86 136*****678', style: defaultStyle),
                      ],
                    ),
                  ),
                ],
              ),
            ),
            Container(
              decoration: BoxDecoration(
                  color: Colors.white, borderRadius: BorderRadius.circular(Sizes.default10)),
              padding: const EdgeInsets.symmetric(
                  horizontal: Sizes.default10, vertical: Sizes.default10),
              margin: const EdgeInsets.only(top: Sizes.default20),
              child: ListBody(
                children: [
                  Container(
                      alignment: Alignment.centerLeft,
                      height: Sizes.default50,
                      child: DrawUnderLine(
                          dx: Sizes.default5,
                          dy: Sizes.default10,
                          child: Text(
                            '订单信息',
                            style: StylesUtils.customTextStyle(color: ColorsUtils.color797),
                          ))),
                  SizedBox(
                    height: Sizes.default40,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text('订单编号', style: defaultStyle),
                        TextButton(
                            onPressed: () {
                              Pasteboard.writeText('15232964103521');
                              Fluttertoast.showToast(
                                  msg: '复制成功',
                                  toastLength: Toast.LENGTH_SHORT,
                                  gravity: ToastGravity.BOTTOM,
                                  timeInSecForIosWeb: 1,
                                  backgroundColor: Colors.black.withOpacity(0.5),
                                  textColor: Colors.white,
                                  fontSize: 15.0);
                            },
                            child: Text.rich(
                              TextSpan(text: '15232964103521  | ', style: defaultStyle, children: [
                                TextSpan(
                                    text: '复制',
                                    style: StylesUtils.customTextStyle(color: ColorsUtils.color006))
                              ]),
                            ))
                      ],
                    ),
                  ),
                  Container(
                    alignment: Alignment.centerLeft,
                    margin: const EdgeInsets.symmetric(vertical: Sizes.default10),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Text('订单编号', style: defaultStyle),
                        Expanded(
                            child: Container(
                          padding: const EdgeInsets.only(left: Sizes.default10),
                          child: InkWell(
                              onTap: () {
                                Get.toNamed(RouteGet.groupOrderTradeSnapshot);
                              },
                              child: Text.rich(
                                TextSpan(text: '发生争议时，可以作为判定依据 ', style: defaultStyle, children: [
                                  WidgetSpan(
                                      child: ToolsUtils.iconRightArrow(),
                                      alignment: PlaceholderAlignment.middle)
                                ]),
                              )),
                        ))
                      ],
                    ),
                  ),
                  SizedBox(
                    height: Sizes.default40,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text('下单时间', style: defaultStyle),
                        Text('2023-02-10 12:15:40', style: defaultStyle),
                      ],
                    ),
                  ),
                  SizedBox(
                    height: Sizes.default40,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text('付款时间', style: defaultStyle),
                        Text('2023-02-10 12:15:40', style: defaultStyle),
                      ],
                    ),
                  ),
                ],
              ),
            )
          ],
        ),
      ),
    );
  }

  void closedTrade() {
    showDialog(
        context: context,
        builder: (_) => StatefulBuilder(
              builder: (context, state) {
                return BrnSingleSelectDialog(
                    isClose: true,
                    title: '关闭交易',
                    messageWidget: Column(
                      children: [
                        Container(
                          alignment: Alignment.centerLeft,
                          child: Text(
                            '关闭交易后无法恢复~',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color797, fontSize: Sizes.default12),
                          ),
                        ),
                        Container(
                          alignment: Alignment.centerLeft,
                          margin: const EdgeInsets.only(top: Sizes.default20),
                          child: Text(
                            '请选择原因',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color797, fontSize: Sizes.default12),
                          ),
                        )
                      ],
                    ),
                    conditions: conditions,
                    submitText: '确定关闭',
                    checkedItem: selectedIndex > -1 ? conditions[selectedIndex] : '',
                    isCustomFollowScroll: true,
                    onItemClick: (BuildContext context, int index) {
                      hintText = conditions[index];
                      selectedIndex = index;
                      state(() {});
                    },
                    onSubmitClick: (String? data) {
                      BrnToast.show(data!, context);
                    });
              },
            ));
  }

  void callMobile() async {
    final dialog = BrnDialog(
        verticalDivider: const VerticalDivider(
          width: 1.0,
          color: Colors.black,
        ),
        divider: const Divider(
          height: 1.0,
          color: Colors.black,
        ),
        contentWidget: ListBody(
          children: [
            Container(
              padding: const EdgeInsets.symmetric(vertical: Sizes.default15),
              alignment: Alignment.center,
              child: Text(
                '联系客户',
                style: StylesUtils.customTextStyle(
                    color: ColorsUtils.color000, fontSize: Sizes.default18),
              ),
            ),
            Container(
              padding: const EdgeInsets.only(bottom: Sizes.default10, left: Sizes.default15, right: Sizes.default15),
              alignment: Alignment.center,
              child: Text(
                '为保护用户的隐私，我们已对您隐藏顾客的真实号码',
                style: StylesUtils.customTextStyle(
                    color: ColorsUtils.color515, fontSize: Sizes.default15),
              ),
            ),
          ],
        ),
        actionsWidget: [
          Container(
              alignment: Alignment.center,
              child: TextButton(
                onPressed: () {
                  Navigator.pop(context, 0);
                },
                child: Text(
                  '取消',
                  style: StylesUtils.customTextStyle(
                      color: ColorsUtils.color333, fontSize: Sizes.default16),
                ),
              )),
          Container(
              alignment: Alignment.center,
              child: TextButton(
                onPressed: () {
                  Navigator.pop(context, 1);
                },
                child: Text('呼叫',
                    style: StylesUtils.customTextStyle(
                        fontSize: Sizes.default16, color: ColorsUtils.colorFf6)),
              ))
        ],
        themeData: BrnDialogConfig(
            dialogWidth: 280,
            radius: Sizes.default10,
            titlePaddingSm: EdgeInsets.zero,
            titlePaddingLg: EdgeInsets.zero,
            contentPaddingSm: EdgeInsets.zero,
            contentPaddingLg: EdgeInsets.zero,
            contentTextAlign: TextAlign.center));
    int? result = await showDialog<int>(
      context: context,
      barrierDismissible: true,
      builder: (BuildContext context) {
        return dialog;
      },
    );
    if (result == 1) {
      /// 拨打电话
      launchPhone('10086');
    }
  }

  void launchPhone(String phoneNumber) async {
    String url = 'tel:$phoneNumber';
    Uri uri = Uri.parse(url);
    await launchUrl(uri);
  }
}
